﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exaction.UI.UserControls;

public partial class _Default : System.Web.UI.Page 
{
    LinkedListBoxes lb = new LinkedListBoxes();
    protected void Page_Load(object sender, EventArgs e)
    {

        
    }
    protected override void CreateChildControls()
    {
        base.CreateChildControls();
        lb = new LinkedListBoxes();
        lb.SourceListBox.Items.Add(new ListItem("Argentina", "1"));
        lb.SourceListBox.Items.Add(new ListItem("United Kingdom", "2"));
        lb.SourceListBox.Items.Add(new ListItem("Mongolia", "3"));
        lb.SourceListBox.Items.Add(new ListItem("France", "4"));

        //set selected item
        ListItem newItem = lb.SourceListBox.Items.FindByValue("4");
        newItem.Selected = true;
        this.PnlFormControls.Controls.Add(lb);
    }
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        LblResult.Visible = true;
        LblResult.Text = "Selected item value(s): ";
        foreach (ListItem item in lb.SelectedItems)
        {
            LblResult.Text += item.Value + ", ";
        }
    }
}